home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / SpeechSynthesis.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  12.9 KB  |  510 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        SpeechSynthesis.a
  3. ;
  4. ;    Contains:    Speech Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__SPEECHSYNTHESIS__') = 'UNDEFINED' THEN
  18. __SPEECHSYNTHESIS__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  24.     include 'MixedMode.a'
  25.     ENDIF
  26.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  27.     include 'Files.a'
  28.     ENDIF
  29.  
  30.  
  31. kTextToSpeechSynthType            EQU        'ttsc'
  32. kTextToSpeechVoiceType            EQU        'ttvd'
  33. kTextToSpeechVoiceFileType        EQU        'ttvf'
  34. kTextToSpeechVoiceBundleType    EQU        'ttvb'
  35.  
  36. kNoEndingProsody                EQU        1
  37. kNoSpeechInterrupt                EQU        2
  38. kPreflightThenPause                EQU        4
  39.  
  40. kImmediate                        EQU        0
  41. kEndOfWord                        EQU        1
  42. kEndOfSentence                    EQU        2
  43.  
  44. ; ------------------------------------------
  45. ;  GetSpeechInfo & SetSpeechInfo selectors    
  46. ; ------------------------------------------
  47.  
  48. soStatus                        EQU        'stat'
  49. soErrors                        EQU        'erro'
  50. soInputMode                        EQU        'inpt'
  51. soCharacterMode                    EQU        'char'
  52. soNumberMode                    EQU        'nmbr'
  53. soRate                            EQU        'rate'
  54. soPitchBase                        EQU        'pbas'
  55. soPitchMod                        EQU        'pmod'
  56. soVolume                        EQU        'volm'
  57. soSynthType                        EQU        'vers'
  58. soRecentSync                    EQU        'sync'
  59. soPhonemeSymbols                EQU        'phsy'
  60. soCurrentVoice                    EQU        'cvox'
  61. soCommandDelimiter                EQU        'dlim'
  62. soReset                            EQU        'rset'
  63. soCurrentA5                        EQU        'myA5'
  64. soRefCon                        EQU        'refc'
  65. soTextDoneCallBack                EQU        'tdcb'                ; use with SpeechTextDoneProcPtr
  66. soSpeechDoneCallBack            EQU        'sdcb'                ; use with SpeechDoneProcPtr
  67. soSyncCallBack                    EQU        'sycb'                ; use with SpeechSyncProcPtr
  68. soErrorCallBack                    EQU        'ercb'                ; use with SpeechErrorProcPtr
  69. soPhonemeCallBack                EQU        'phcb'                ; use with SpeechPhonemeProcPtr
  70. soWordCallBack                    EQU        'wdcb'
  71. soSynthExtension                EQU        'xtnd'
  72. soSoundOutput                    EQU        'sndo'
  73.  
  74. ; ------------------------------------------
  75. ;  Speaking Mode Constants                     
  76. ; ------------------------------------------
  77.  
  78. modeText                        EQU        'TEXT'                ; input mode constants                     
  79. modePhonemes                    EQU        'PHON'
  80. modeNormal                        EQU        'NORM'                ; character mode and number mode constants 
  81. modeLiteral                        EQU        'LTRL'
  82.  
  83.  
  84. soVoiceDescription                EQU        'info'
  85. soVoiceFile                        EQU        'fref'
  86.  
  87.  
  88.  
  89.  
  90. VoiceSpec                RECORD 0
  91. creator                     ds.l    1                ; offset: $0 (0)
  92. id                         ds.l    1                ; offset: $4 (4)
  93. sizeof                     EQU *                    ; size:   $8 (8)
  94.                         ENDR
  95. ; typedef struct VoiceSpec *            VoiceSpecPtr
  96.  
  97.  
  98.  
  99. kNeuter                            EQU        0
  100. kMale                            EQU        1
  101. kFemale                            EQU        2
  102.  
  103.  
  104.  
  105. VoiceDescription        RECORD 0
  106. length                     ds.l    1                ; offset: $0 (0)
  107. voice                     ds        VoiceSpec        ; offset: $4 (4)
  108. version                     ds.l    1                ; offset: $C (12)
  109. name                     ds        Str63            ; offset: $10 (16)
  110. comment                     ds        Str255            ; offset: $50 (80)
  111. gender                     ds.w    1                ; offset: $150 (336)
  112. age                         ds.w    1                ; offset: $152 (338)
  113. script                     ds.w    1                ; offset: $154 (340)
  114. language                 ds.w    1                ; offset: $156 (342)
  115. region                     ds.w    1                ; offset: $158 (344)
  116. reserved                 ds.l    4                ; offset: $15A (346)
  117. sizeof                     EQU *                    ; size:   $16A (362)
  118.                         ENDR
  119.  
  120.  
  121. VoiceFileInfo            RECORD 0
  122. fileSpec                 ds        FSSpec            ; offset: $0 (0)
  123. resID                     ds.w    1                ; offset: $46 (70)
  124. sizeof                     EQU *                    ; size:   $48 (72)
  125.                         ENDR
  126. SpeechStatusInfo        RECORD 0
  127. outputBusy                 ds.b    1                ; offset: $0 (0)
  128. outputPaused             ds.b    1                ; offset: $1 (1)
  129. inputBytesLeft             ds.l    1                ; offset: $2 (2)
  130. phonemeCode                 ds.w    1                ; offset: $6 (6)
  131. sizeof                     EQU *                    ; size:   $8 (8)
  132.                         ENDR
  133.  
  134.  
  135. SpeechErrorInfo            RECORD 0
  136. count                     ds.w    1                ; offset: $0 (0)
  137. oldest                     ds.w    1                ; offset: $2 (2)
  138. oldPos                     ds.l    1                ; offset: $4 (4)
  139. newest                     ds.w    1                ; offset: $8 (8)
  140. newPos                     ds.l    1                ; offset: $A (10)
  141. sizeof                     EQU *                    ; size:   $E (14)
  142.                         ENDR
  143.  
  144.  
  145. SpeechVersionInfo        RECORD 0
  146. synthType                 ds.l    1                ; offset: $0 (0)
  147. synthSubType             ds.l    1                ; offset: $4 (4)
  148. synthManufacturer         ds.l    1                ; offset: $8 (8)
  149. synthFlags                 ds.l    1                ; offset: $C (12)
  150. synthVersion             ds        NumVersion        ; offset: $10 (16)
  151. sizeof                     EQU *                    ; size:   $14 (20)
  152.                         ENDR
  153.  
  154.  
  155. PhonemeInfo                RECORD 0
  156. opcode                     ds.w    1                ; offset: $0 (0)
  157. phStr                     ds        Str15            ; offset: $2 (2)
  158. exampleStr                 ds        Str31            ; offset: $12 (18)
  159. hiliteStart                 ds.w    1                ; offset: $32 (50)
  160. hiliteEnd                 ds.w    1                ; offset: $34 (52)
  161. sizeof                     EQU *                    ; size:   $36 (54)
  162.                         ENDR
  163.  
  164. PhonemeDescriptor        RECORD 0
  165. phonemeCount             ds.w    1                ; offset: $0 (0)
  166. thePhonemes                 ds        PhonemeInfo        ; offset: $2 (2) <-- really an array of length one
  167. sizeof                     EQU *                    ; size:   $38 (56)
  168.                         ENDR
  169. SpeechXtndData            RECORD 0
  170. synthCreator             ds.l    1                ; offset: $0 (0)
  171. synthData                 ds.b    2                ; offset: $4 (4)
  172. sizeof                     EQU *                    ; size:   $6 (6)
  173.                         ENDR
  174.  
  175. DelimiterInfo            RECORD 0
  176. startDelimiter             ds.b    2                ; offset: $0 (0)
  177. endDelimiter             ds.b    2                ; offset: $2 (2)
  178. sizeof                     EQU *                    ; size:   $4 (4)
  179.                         ENDR
  180.  
  181. ;
  182. ; pascal NumVersion SpeechManagerVersion(void )
  183. ;
  184.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  185.         Macro
  186.         _SpeechManagerVersion
  187.             move.l              #$0000000C,D0
  188.             dc.w                $A800
  189.         EndM
  190.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  191.         IMPORT_CFM_FUNCTION SpeechManagerVersion
  192.     ENDIF
  193.  
  194. ;
  195. ; pascal OSErr MakeVoiceSpec(OSType creator, OSType id, VoiceSpec *voice)
  196. ;
  197.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  198.         Macro
  199.         _MakeVoiceSpec
  200.             move.l              #$0604000C,D0
  201.             dc.w                $A800
  202.         EndM
  203.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  204.         IMPORT_CFM_FUNCTION MakeVoiceSpec
  205.     ENDIF
  206.  
  207. ;
  208. ; pascal OSErr CountVoices(short *numVoices)
  209. ;
  210.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  211.         Macro
  212.         _CountVoices
  213.             move.l              #$0108000C,D0
  214.             dc.w                $A800
  215.         EndM
  216.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  217.         IMPORT_CFM_FUNCTION CountVoices
  218.     ENDIF
  219.  
  220. ;
  221. ; pascal OSErr GetIndVoice(short index, VoiceSpec *voice)
  222. ;
  223.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  224.         Macro
  225.         _GetIndVoice
  226.             move.l              #$030C000C,D0
  227.             dc.w                $A800
  228.         EndM
  229.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  230.         IMPORT_CFM_FUNCTION GetIndVoice
  231.     ENDIF
  232.  
  233. ;
  234. ; pascal OSErr GetVoiceDescription(const VoiceSpec *voice, VoiceDescription *info, long infoLength)
  235. ;
  236.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  237.         Macro
  238.         _GetVoiceDescription
  239.             move.l              #$0610000C,D0
  240.             dc.w                $A800
  241.         EndM
  242.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  243.         IMPORT_CFM_FUNCTION GetVoiceDescription
  244.     ENDIF
  245.  
  246. ;
  247. ; pascal OSErr GetVoiceInfo(const VoiceSpec *voice, OSType selector, void *voiceInfo)
  248. ;
  249.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  250.         Macro
  251.         _GetVoiceInfo
  252.             move.l              #$0614000C,D0
  253.             dc.w                $A800
  254.         EndM
  255.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  256.         IMPORT_CFM_FUNCTION GetVoiceInfo
  257.     ENDIF
  258.  
  259. ;
  260. ; pascal OSErr NewSpeechChannel(VoiceSpecPtr voice, SpeechChannel *chan)
  261. ;
  262.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  263.         Macro
  264.         _NewSpeechChannel
  265.             move.l              #$0418000C,D0
  266.             dc.w                $A800
  267.         EndM
  268.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  269.         IMPORT_CFM_FUNCTION NewSpeechChannel
  270.     ENDIF
  271.  
  272. ;
  273. ; pascal OSErr DisposeSpeechChannel(SpeechChannel chan)
  274. ;
  275.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  276.         Macro
  277.         _DisposeSpeechChannel
  278.             move.l              #$021C000C,D0
  279.             dc.w                $A800
  280.         EndM
  281.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  282.         IMPORT_CFM_FUNCTION DisposeSpeechChannel
  283.     ENDIF
  284.  
  285. ;
  286. ; pascal OSErr SpeakString(ConstStr255Param textToBeSpoken)
  287. ;
  288.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  289.         Macro
  290.         _SpeakString
  291.             move.l              #$0220000C,D0
  292.             dc.w                $A800
  293.         EndM
  294.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  295.         IMPORT_CFM_FUNCTION SpeakString
  296.     ENDIF
  297.  
  298. ;
  299. ; pascal OSErr SpeakText(SpeechChannel chan, const void *textBuf, unsigned long textBytes)
  300. ;
  301.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  302.         Macro
  303.         _SpeakText
  304.             move.l              #$0624000C,D0
  305.             dc.w                $A800
  306.         EndM
  307.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  308.         IMPORT_CFM_FUNCTION SpeakText
  309.     ENDIF
  310.  
  311. ;
  312. ; pascal OSErr SpeakBuffer(SpeechChannel chan, const void *textBuf, unsigned long textBytes, long controlFlags)
  313. ;
  314.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  315.         Macro
  316.         _SpeakBuffer
  317.             move.l              #$0828000C,D0
  318.             dc.w                $A800
  319.         EndM
  320.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  321.         IMPORT_CFM_FUNCTION SpeakBuffer
  322.     ENDIF
  323.  
  324. ;
  325. ; pascal OSErr StopSpeech(SpeechChannel chan)
  326. ;
  327.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  328.         Macro
  329.         _StopSpeech
  330.             move.l              #$022C000C,D0
  331.             dc.w                $A800
  332.         EndM
  333.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  334.         IMPORT_CFM_FUNCTION StopSpeech
  335.     ENDIF
  336.  
  337. ;
  338. ; pascal OSErr StopSpeechAt(SpeechChannel chan, long whereToStop)
  339. ;
  340.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  341.         Macro
  342.         _StopSpeechAt
  343.             move.l              #$0430000C,D0
  344.             dc.w                $A800
  345.         EndM
  346.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  347.         IMPORT_CFM_FUNCTION StopSpeechAt
  348.     ENDIF
  349.  
  350. ;
  351. ; pascal OSErr PauseSpeechAt(SpeechChannel chan, long whereToPause)
  352. ;
  353.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  354.         Macro
  355.         _PauseSpeechAt
  356.             move.l              #$0434000C,D0
  357.             dc.w                $A800
  358.         EndM
  359.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  360.         IMPORT_CFM_FUNCTION PauseSpeechAt
  361.     ENDIF
  362.  
  363. ;
  364. ; pascal OSErr ContinueSpeech(SpeechChannel chan)
  365. ;
  366.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  367.         Macro
  368.         _ContinueSpeech
  369.             move.l              #$0238000C,D0
  370.             dc.w                $A800
  371.         EndM
  372.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  373.         IMPORT_CFM_FUNCTION ContinueSpeech
  374.     ENDIF
  375.  
  376. ;
  377. ; pascal short SpeechBusy(void )
  378. ;
  379.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  380.         Macro
  381.         _SpeechBusy
  382.             move.l              #$003C000C,D0
  383.             dc.w                $A800
  384.         EndM
  385.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  386.         IMPORT_CFM_FUNCTION SpeechBusy
  387.     ENDIF
  388.  
  389. ;
  390. ; pascal short SpeechBusySystemWide(void )
  391. ;
  392.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  393.         Macro
  394.         _SpeechBusySystemWide
  395.             move.l              #$0040000C,D0
  396.             dc.w                $A800
  397.         EndM
  398.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  399.         IMPORT_CFM_FUNCTION SpeechBusySystemWide
  400.     ENDIF
  401.  
  402. ;
  403. ; pascal OSErr SetSpeechRate(SpeechChannel chan, Fixed rate)
  404. ;
  405.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  406.         Macro
  407.         _SetSpeechRate
  408.             move.l              #$0444000C,D0
  409.             dc.w                $A800
  410.         EndM
  411.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  412.         IMPORT_CFM_FUNCTION SetSpeechRate
  413.     ENDIF
  414.  
  415. ;
  416. ; pascal OSErr GetSpeechRate(SpeechChannel chan, Fixed *rate)
  417. ;
  418.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  419.         Macro
  420.         _GetSpeechRate
  421.             move.l              #$0448000C,D0
  422.             dc.w                $A800
  423.         EndM
  424.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  425.         IMPORT_CFM_FUNCTION GetSpeechRate
  426.     ENDIF
  427.  
  428. ;
  429. ; pascal OSErr SetSpeechPitch(SpeechChannel chan, Fixed pitch)
  430. ;
  431.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  432.         Macro
  433.         _SetSpeechPitch
  434.             move.l              #$044C000C,D0
  435.             dc.w                $A800
  436.         EndM
  437.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  438.         IMPORT_CFM_FUNCTION SetSpeechPitch
  439.     ENDIF
  440.  
  441. ;
  442. ; pascal OSErr GetSpeechPitch(SpeechChannel chan, Fixed *pitch)
  443. ;
  444.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  445.         Macro
  446.         _GetSpeechPitch
  447.             move.l              #$0450000C,D0
  448.             dc.w                $A800
  449.         EndM
  450.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  451.         IMPORT_CFM_FUNCTION GetSpeechPitch
  452.     ENDIF
  453.  
  454. ;
  455. ; pascal OSErr SetSpeechInfo(SpeechChannel chan, OSType selector, const void *speechInfo)
  456. ;
  457.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  458.         Macro
  459.         _SetSpeechInfo
  460.             move.l              #$0654000C,D0
  461.             dc.w                $A800
  462.         EndM
  463.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  464.         IMPORT_CFM_FUNCTION SetSpeechInfo
  465.     ENDIF
  466.  
  467. ;
  468. ; pascal OSErr GetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  469. ;
  470.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  471.         Macro
  472.         _GetSpeechInfo
  473.             move.l              #$0658000C,D0
  474.             dc.w                $A800
  475.         EndM
  476.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  477.         IMPORT_CFM_FUNCTION GetSpeechInfo
  478.     ENDIF
  479.  
  480. ;
  481. ; pascal OSErr TextToPhonemes(SpeechChannel chan, const void *textBuf, unsigned long textBytes, Handle phonemeBuf, long *phonemeBytes)
  482. ;
  483.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  484.         Macro
  485.         _TextToPhonemes
  486.             move.l              #$0A5C000C,D0
  487.             dc.w                $A800
  488.         EndM
  489.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  490.         IMPORT_CFM_FUNCTION TextToPhonemes
  491.     ENDIF
  492.  
  493. ;
  494. ; pascal OSErr UseDictionary(SpeechChannel chan, Handle dictionary)
  495. ;
  496.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  497.         Macro
  498.         _UseDictionary
  499.             move.l              #$0460000C,D0
  500.             dc.w                $A800
  501.         EndM
  502.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  503.         IMPORT_CFM_FUNCTION UseDictionary
  504.     ENDIF
  505.  
  506.  
  507.  
  508.     ENDIF ; __SPEECHSYNTHESIS__ 
  509.  
  510.